using Baci.Net.ToolKit.ArcGISProGeoprocessor.Models;
using Baci.Net.ToolKit.ArcGISProGeoprocessor.Models.Attributes;
using Baci.Net.ToolKit.ArcGISProGeoprocessor.Models.Attributes.DomainAttributes;
using Baci.Net.ToolKit.ArcGISProGeoprocessor.Models.Enums;
using System.Collections.Generic;
using System.ComponentModel;

namespace Baci.ArcGIS._ModelTools._ModelOnly
{
    /// <summary>
    /// <para>Stop</para>
    /// <para>Exits a model out of the iteration loop if the input values are set to true or set to false.  For the set of input values, iteration will continue if all the inputs are true and stop if any one of the inputs is false. It is functionally similar to the While tool but is useful to stop a model if there is one While iterator in a model and no additional iterators can be added.</para>
    /// <para>如果输入值设置为 true 或设置为 false，则将模型退出迭代循环。 对于输入值集，如果所有输入都为 true，则迭代将继续，如果任何一个输入为 false，则迭代将停止。它在功能上类似于 While 工具，但如果模型中有一个 While 迭代器并且无法添加其他迭代器，则停止模型很有用。</para>
    /// </summary>    
    [DisplayName("Stop")]
    public class Stop : AbstractGPProcess
    {
        /// <summary>
        /// 无参构造
        /// </summary>
        public Stop()
        {

        }

        /// <summary>
        /// 有参构造
        /// </summary>
        /// <param name="_in_values">
        /// <para>Input Values</para>
        /// <para>The values that will be checked before the model iteration will stop.</para>
        /// <para>在模型迭代停止之前将检查的值。</para>
        /// </param>
        public Stop(List<object> _in_values)
        {
            this._in_values = _in_values;
        }
        public override string ToolboxName => "Model Tools";

        public override string ToolName => "Stop";

        public override string CallName => "mb.Stop";

        public override List<string> AcceptEnvironments => [];

        public override object[] ParameterInfo => [_in_values, _condition.GetGPValue(), _continue];

        /// <summary>
        /// <para>Input Values</para>
        /// <para>The values that will be checked before the model iteration will stop.</para>
        /// <para>在模型迭代停止之前将检查的值。</para>
        /// <para></para>
        /// </summary>
        [DisplayName("Input Values")]
        [Description("")]
        [Option(OptionTypeEnum.Must)]
        public List<object> _in_values { get; set; }


        /// <summary>
        /// <para>Stop when inputs are</para>
        /// <para><xdoc>
        ///   <para>Specifies whether the iteration will run until all the inputs values are true or all the input values are false.</para>
        ///   <bulletList>
        ///     <bullet_item>True—The iteration will run until all the input values are true. This is the default.</bullet_item><para/>
        ///     <bullet_item>False—The iteration will run until all the input values are false.</bullet_item><para/>
        ///   </bulletList>
        /// </xdoc></para>
        /// <para><xdoc>
        ///   <para>指定迭代是运行到所有输入值都为 true 还是所有输入值都为 false。</para>
        ///   <bulletList>
        ///     <bullet_item>True - 迭代将运行，直到所有输入值都为 true。这是默认设置。</bullet_item><para/>
        ///     <bullet_item>False - 迭代将运行，直到所有输入值都为 false。</bullet_item><para/>
        ///   </bulletList>
        /// </xdoc></para>
        /// <para></para>
        /// </summary>
        [DisplayName("Stop when inputs are")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public _condition_value _condition { get; set; } = _condition_value._TRUE;

        public enum _condition_value
        {
            /// <summary>
            /// <para>True</para>
            /// <para>True—The iteration will run until all the input values are true. This is the default.</para>
            /// <para>True - 迭代将运行，直到所有输入值都为 true。这是默认设置。</para>
            /// </summary>
            [Description("True")]
            [GPEnumValue("TRUE")]
            _TRUE,

            /// <summary>
            /// <para>False</para>
            /// <para>False—The iteration will run until all the input values are false.</para>
            /// <para>False - 迭代将运行，直到所有输入值都为 false。</para>
            /// </summary>
            [Description("False")]
            [GPEnumValue("FALSE")]
            _FALSE,

        }

        /// <summary>
        /// <para>Continue</para>
        /// <para></para>
        /// <para></para>
        /// <para></para>
        /// </summary>
        [DisplayName("Continue")]
        [Description("")]
        [Option(OptionTypeEnum.derived)]
        public object _continue { get; set; }


        public Stop SetEnv()
        {
            base.SetEnv();
            return this;
        }

    }

}